package zjh_20230313;

import java.util.*;


public class practise02 {
    public static void main(String[] args) {
        test();
    }

    public static void test() {
        List<Person02> list = List.of(new Person02("张三", 22, '男'),
                new Person02("李四", 20, '女'),
                new Person02("王五", 21, '男'),
                new Person02("孙六", 23, '女'),
                new Person02("zs", 34, '男'));


        LinkedList<Person02> list1 = new LinkedList<>(list);
//        Collections.sort(list1, new Comparator<Person02>() {
//            @Override
//            public int compare(Person02 o1, Person02 o2) {
//                return o1.getAge() - o2.getAge();
//            }
//        });


//        list1.compareTo(list1);
        /*
        TreeSet<Person02> treeSet = new TreeSet<>(list);

        for (Person02 p :
                treeSet) {
            System.out.println(p);
        }
*/
        ArrayList<Person02> arrayList = new ArrayList(list);
        Collections.sort(arrayList);

        for (Person02 p :
                arrayList) {
            System.out.println(p);
        }

//        list1.sort(null);
//        for (Person02 p :
//                list1) {
//            System.out.println(p);
//        }

    }
}
